﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ggprot
{
    class MsgRecipients
    {
        private byte flag;
        private int count;
        private int[] recipients;

        public int[] Recipients
        {
            get { return recipients; }
            set { recipients = value; }
        }

        public int Count
        {
            get { return count; }
            set { count = value; }
        }

        public byte Flag
        {
            get { return flag; }
            set { flag = value; }
        }

        public byte[] GetBytes()
        {
            byte[] bytes = new byte[5 + recipients.Length * 4];
            BitConverter.GetBytes(flag).CopyTo(bytes, 0);
            BitConverter.GetBytes(count).CopyTo(bytes, 1);
            for (int i = 0; i < recipients.Length; i++)
                BitConverter.GetBytes(recipients[i]).CopyTo(bytes, 5 + i * 4);

            return bytes;
        }
    }
}
